package cn.tedu.oa.approval.controller;

import cn.tedu.oa.approval.pojo.dto.ApprovalQuery;
import cn.tedu.oa.approval.pojo.dto.ApprovalSaveparm;
import cn.tedu.oa.approval.pojo.vo.ApprovalVO;
import cn.tedu.oa.approval.service.ApprovalService;
import cn.tedu.oa.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Arg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/oa1/approval")
public class ApprovalController {
    @Autowired
    ApprovalService approvalService;
    @GetMapping("/select")
    public JsonResult select(ApprovalQuery approvalQuery){
        log.debug("查询审批记录"+approvalQuery);
        List<ApprovalVO> list = approvalService.select(approvalQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("/save")
    public JsonResult save(ApprovalSaveparm approvalsSaveparm){
        log.debug("新增审批记录"+approvalsSaveparm);
        approvalService.save(approvalsSaveparm);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete( @PathVariable Integer id){
        log.debug("删除审批记录"+id);
        approvalService.delete(id);
        return JsonResult.ok();
    }

}
